<template>
  <div class="recharge">
    <el-form :model="rechargeForm" label-position="right" label-width="100px">
      <el-form-item label="停车场名称:"> {{row.parkName}} </el-form-item>
      <el-form-item label="剩余时长:"> {{row.balance}} 小时 </el-form-item>
      <el-form-item label="充值时长:">
        <el-input v-model="rechargeForm.buyLength"></el-input> 小时
      </el-form-item>
      <el-form-item label="充值费用:">
        <el-input v-model="rechargeForm.buyCost"></el-input> 元
      </el-form-item>
      <div style="text-align: center;">
        <el-button type="info">取消</el-button>
        <el-button type="primary" @click="recharge">充值并继续合作</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>

  export default {
    name: 'recharge',
    props: ['row'],
    data() {
      return {
        rechargeForm: {
          parkId:null
        }
      }
    },
    mounted() {
      this.rechargeForm.parkId = this.row.parkId
    },
    methods: {
      recharge() {
        // this.rechargeForm.token = sessionStorage.getItem("token");;
        this.$axios({
          method: 'post',
          url: '/api/sPlatRechargeRecord/addPlat',
          data: this.rechargeForm
        }).then((res) => {
          console.log(res)
        })
      }
    }
  }
</script>

<style scoped>
  .recharge {
    padding: 0 10px;
  }
  .el-input {
    width: 160px;
  }

</style>
